home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / FALCON / ACC / DRIVERS.ACC / OPTIONS.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-10  |  20.1 KB  |  777 lines

  1. /* ======================================================================
  2.  * FILE: OPTIONS.C
  3.  * ======================================================================
  4.  * DATE: November 23, 1992
  5.  *       December 15, 1992    Added Print Area Offsets
  6.  *     January 22, 1993       Removed CheckOS
  7.  *                Used Defines for countries and cm/inches
  8.  *
  9.  * This file handles the options dialog box which allows one to
  10.  * change the parameters of a printer. Note: it is NOT in its own window.
  11.  */
  12.  
  13.  
  14. /* INCLUDE FILES
  15.  * ======================================================================
  16.  */
  17. #include <sys\gemskel.h>
  18. #include <string.h>
  19. #include <tos.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22.  
  23. #include "country.h"
  24. #include "drivers.h"
  25. #include "drvhead.h"
  26. #include "device.h"
  27. #include "popmenu.h"
  28. #include "fsmio.h"
  29. #include "fileio.h"
  30. #include "text.h"
  31. #include "mainstuf.h"
  32.  
  33.  
  34. /* EXTERNS
  35.  * ======================================================================
  36.  */
  37. extern int AES_Version;
  38.  
  39.  
  40. /* PROTOTYPES
  41.  * ======================================================================
  42.  */
  43. void     do_modify( void );
  44. void     WaitUpButton( void );
  45. void     ClearCheckMarks( void );
  46. int     execform( OBJECT *xtree, int start_obj );
  47. void     DoDrivers( int num );
  48.  
  49.  
  50.     
  51. /* DEFINES
  52.  * ======================================================================
  53.  */
  54. typedef struct _menu_id
  55. {
  56.   int  menuid;
  57.   int  curvalue;
  58.   char text[ 10 ];
  59.   int  num_items;
  60. } MENU_ID; 
  61.  
  62. #define DRAW3D2 0x0200
  63. #define DRAW3D1 0x0100
  64.  
  65.  
  66. #define MAX_MENUS    8
  67.  
  68. #define MQUALITY    0
  69. #define MCOLOR        1
  70. #define MPAGESIZE    2
  71. #define MREZ        3
  72. #define MPORT        4
  73. #define MTRAY        5
  74. #define MHSIZE        6
  75. #define MVSIZE        7
  76.  
  77.  
  78. /* EXTERNALS
  79.  * ======================================================================
  80.  */
  81.  
  82.  
  83. /* GLOBALS
  84.  * ======================================================================
  85.  */
  86. MENU_ID Menu[ MAX_MENUS ];
  87.  
  88.  
  89. char *hsize_text[] = {
  90.             "0123",
  91.             "0123",
  92.             "0123",
  93.             "0123"
  94.              };
  95.            
  96. char *vsize_text[] = {
  97.             "0123",
  98.             "0123",
  99.             "0123",
  100.             "0123"
  101.              };
  102.                         
  103. char    title[ 128 ];
  104. char    xtext[6];
  105. char    ytext[6];
  106.  
  107. int     xres_value;    /* Value of the current XRES and YRES variables */
  108. int     yres_value;    /* for the submenus...                */
  109. int     Tos_Country;    /* TOS Country Version */
  110. int    SecondPageTable;    /* Existence of a 2nd Page Table */
  111. int    PageOffset;        /* 1 = Page Offsets ON, 0 -> OFF */
  112.  
  113.  
  114.  
  115.  
  116. /* FUNCTIONS
  117.  * ======================================================================
  118.  */
  119.  
  120.  
  121. /* OptionInit()
  122.  * ======================================================================
  123.  */
  124. void
  125. OptionInit( void )
  126. {
  127.       /* Initialize PopUp Menus and Menu IDs */
  128.       InitPopUpMenus();
  129.       SetSubMenuDelay( 300L );
  130.       SetSubDragDelay( 3000L );
  131.       SetArrowClickDelay( 150L );
  132.  
  133.       Menu[ MQUALITY ].menuid  = InsertPopUpMenu( print_text[0], 2, 2 );
  134.       Menu[ MPAGESIZE ].menuid = InsertPopUpMenu( size_text[0], 5, 5 );
  135.       Menu[ MREZ ].menuid      = InsertPopUpMenu( rez_text[0], 2, 2 );
  136.  
  137.       Menu[ MCOLOR ].menuid    = InsertPopUpMenu( color_text[0], 4, 4 );
  138.       Menu[ MPORT ].menuid     = InsertPopUpMenu( port_text[0], 2, 2 );
  139.       Menu[ MTRAY ].menuid     = InsertPopUpMenu( tray_text[0], 4, 4 );
  140. }
  141.  
  142.  
  143.  
  144. /* OptionEnd()
  145.  * ======================================================================
  146.  */
  147. void
  148. OptionEnd( void )
  149. {
  150.      DeletePopUpMenu( Menu[ MQUALITY ].menuid );
  151.      DeletePopUpMenu( Menu[ MPAGESIZE ].menuid );
  152.      DeletePopUpMenu( Menu[ MREZ ].menuid );
  153.      DeletePopUpMenu( Menu[ MCOLOR ].menuid );
  154.      DeletePopUpMenu( Menu[ MPORT ].menuid );
  155.      DeletePopUpMenu( Menu[ MTRAY ].menuid );
  156. }
  157.     
  158.  
  159.  
  160.  
  161.  
  162. /* do_modify()
  163.  * ======================================================================
  164.  */
  165. void
  166. do_modify( void )
  167. {
  168.    GRECT rect;
  169.    GRECT xrect;
  170.    int   button;
  171.    int   obj;
  172.    MRETS mk;
  173.    int   menuid;
  174.  
  175.    long  value;
  176.    int   item;
  177.    int   id;
  178.    int   xobj;
  179.    int   xtitle;
  180.    int   curvalue;
  181.    int   offset;
  182.    char  **txtptr;
  183.    int   i;
  184.    int   output;
  185.    double tempx, tempy;
  186.    int    xstart;   
  187.  
  188.    int   xdpi,ydpi;
  189.    float Xres,Yres;
  190.             
  191.    ActiveTree( drivetree );
  192.  
  193.    xres_value = hdr->xres;    /* Set the globals for xres and yres */
  194.    yres_value = hdr->yres;
  195.    ClearCheckMarks();
  196.  
  197.    /* CJG - Initialize xdpi, ydpi, Xres and Yres */
  198.    xdpi = hdr->X_PIXEL[ hdr->nplanes - 1 ];
  199.    ydpi = hdr->Y_PIXEL[ hdr->nplanes - 1 ];
  200.  
  201.    /* ZERO BASED - so we add 1 pixel */
  202.    Xres = hdr->xres + 1;
  203.    Yres = hdr->yres + 1;
  204.             
  205.    Xres /= xdpi;    /* gets us inches */
  206.    Yres /= ydpi;
  207.  
  208.  
  209.  
  210.    Menu[ MQUALITY ].curvalue = hdr->quality;
  211.    strcpy( Menu[ MQUALITY ].text, print_text[ Menu[ MQUALITY ].curvalue + 2 ] );
  212.    
  213.    Menu[ MPAGESIZE ].curvalue = hdr->PageSize;
  214.    strcpy( Menu[ MPAGESIZE ].text, size_text[ Menu[ MPAGESIZE ].curvalue + 5 ] );
  215.    
  216.    Menu[ MCOLOR ].curvalue = max( 0, hdr->nplanes - 1 );
  217.    Menu[ MVSIZE ].curvalue = max( 0, hdr->nplanes - 1 );
  218.    Menu[ MHSIZE ].curvalue = max( 0, hdr->nplanes - 1 );
  219.    strcpy( Menu[ MCOLOR ].text, color_text[ Menu[ MCOLOR ].curvalue ] );
  220.  
  221.    Menu[ MPORT ].curvalue = hdr->port;   
  222.    strcpy( Menu[ MPORT ].text, port_text[ Menu[ MPORT ].curvalue + 2 ] );
  223.    
  224.    Menu[ MTRAY ].curvalue = hdr->paper_feed;
  225.    strcpy( Menu[ MTRAY ].text, tray_text[ Menu[ MTRAY ].curvalue + 4 ] );
  226.    strcpy( Menu[ MVSIZE ].text, vsize_text[ Menu[ MVSIZE ].curvalue ] );
  227.    strcpy( Menu[ MHSIZE ].text, hsize_text[ Menu[ MHSIZE ].curvalue ] );
  228.  
  229.    if( hdr->config_map & 0x0040 )    /* Check for Color...*/
  230.    {
  231.       MakeShadow( DCOLOR );
  232.       MakeTouchExit( DCOLOR );
  233.    }
  234.    else
  235.    {
  236.       NoShadow( DCOLOR );
  237.       NoTouchExit( DCOLOR );
  238.    }    
  239.    
  240.    if( hdr->config_map & 0x0001 )  /* Check for Print Quality */
  241.    {
  242.      MakeShadow( DPRINT );
  243.      MakeTouchExit( DPRINT );
  244.    }
  245.    else
  246.    {
  247.       NoShadow( DPRINT );
  248.       NoTouchExit( DPRINT );
  249.    }
  250.  
  251.    if( hdr->config_map & 0x0100 ) /* Check for Port */
  252.    {
  253.      MakeShadow( DPORT );
  254.      MakeTouchExit( DPORT );
  255.    }
  256.    else
  257.    {
  258.       NoShadow( DPORT );
  259.       NoTouchExit( DPORT );
  260.    }
  261.       
  262.    if( Menu[ MTRAY ].num_items > 1 ) /* Check for Trays */
  263.    {
  264.      MakeShadow( DTRAY );
  265.      MakeTouchExit( DTRAY );
  266.    }
  267.    else
  268.    {
  269.       NoShadow( DTRAY );
  270.       NoTouchExit( DTRAY );
  271.    }
  272.      
  273.    if( Menu[ MPAGESIZE ].num_items > 1 )
  274.    {
  275.      MakeShadow( DPAGE );
  276.      MakeTouchExit( DPAGE );
  277.    }
  278.    else
  279.    {
  280.       /* If there is only the pagetype of OTHER, then display it.*/
  281.       if( Menu[ MPAGESIZE ].curvalue == 4 )
  282.       {
  283.         MakeShadow( DPAGE );
  284.         MakeTouchExit( DPAGE );
  285.       }
  286.       else
  287.       {
  288.         NoShadow( DPAGE );
  289.         NoTouchExit( DPAGE );
  290.       }  
  291.    }
  292.         
  293.    ObString( DPRINT ) = Menu[ MQUALITY ].text;
  294.    ObString( DPAGE )  = Menu[ MPAGESIZE ].text;     
  295.    ObString( DCOLOR ) = Menu[ MCOLOR ].text;
  296.    ObString( DPORT )  = Menu[ MPORT ].text;
  297.    ObString( DTRAY )  = Menu[ MTRAY ].text;    
  298.    ObString( DHSIZE ) = Menu[ MHSIZE ].text;
  299.    ObString( DVSIZE ) = Menu[ MVSIZE ].text;
  300.     
  301.    TedText( DDRIVER ) = title;
  302.  
  303.  
  304.    for( i = MQUALITY; i <= MTRAY; i++ )
  305.    {
  306.       CheckItem( Menu[ i ].menuid, Menu[i].curvalue, TRUE );
  307.       SetStartItem( Menu[i].menuid, Menu[i].curvalue );
  308.    }
  309.  
  310.  
  311.    /* Check if there is a Second Page Size Table
  312.     * TRUE - YES - there is a second page size table
  313.     * FALSE - No, there is only one page size table.
  314.     */
  315.    SecondPageTable = ( hdr->config_map & 0x2000 );
  316.  
  317.    Deselect( AREAON );
  318.    Deselect( AREAOFF );
  319.  
  320.    /* Set ON/OFF for Page Offsets */
  321.    if( !mhdr->TopMargin && !mhdr->BottomMargin && !mhdr->LeftMargin &&
  322.        !mhdr->RightMargin )
  323.    {
  324.        /* Page Area Offset is OFF */    
  325.        PageOffset = FALSE;
  326.        Select( AREAOFF );
  327.    }    
  328.    else
  329.    {
  330.        /* Page Area Offset is ON */
  331.        PageOffset = TRUE;
  332.        Select( AREAON );
  333.    }    
  334.        
  335.    
  336.    
  337.    Menu[ MREZ ].curvalue = 0;
  338.    SetStartItem( Menu[ MREZ ].menuid, 0 );
  339.    CheckItem( Menu[ MREZ ].menuid, 0, FALSE );
  340.    CheckItem( Menu[ MREZ ].menuid, 1, FALSE );
  341.    
  342.    Form_center( tree, &rect );
  343.    Form_dial( FMD_START, &rect, &rect );
  344.    Objc_draw( tree, ROOT, MAX_DEPTH, &rect );
  345.    do
  346.    {
  347.  
  348.       button = form_do( tree, 0 );
  349.       if( button & 0x8000 )
  350.           button &= 0x7FFF;      
  351.  
  352.       if(( button != DOK ) && ( button != DCANCEL ))
  353.       {             
  354.          xrect = ObRect( button );
  355.           objc_offset( tree, button, &xrect.g_x, &xrect.g_y );
  356.  
  357.      /* Fake the BUTTON Select/Deselect with this touchexit */
  358.          do
  359.          {
  360.           Graf_mkstate( &mk );
  361.           obj = objc_find( tree, ROOT, MAX_DEPTH, mk.x, mk.y );
  362.           if( obj != button )
  363.           {
  364.              if( IsSelected( button ) )
  365.                deselect( tree, button );
  366.           }
  367.  
  368.          if( obj == button )
  369.          {
  370.             if( !IsSelected( button ) )
  371.               select( tree, button );
  372.          }         
  373.          
  374.          }while( mk.buttons );
  375.          
  376.      if( ( obj == button ) && ( !IsDisabled( obj ) ) )
  377.      {
  378.         switch( button )
  379.         {
  380.            case DPRINT:  menuid   = Menu[ MQUALITY ].menuid;
  381.                  curvalue = Menu[ MQUALITY ].curvalue;
  382.                  xobj     = MQUALITY;            
  383.                  offset   = 2;
  384.                  txtptr   = print_text;
  385.                  xtitle   = QTITLE;
  386.                   break;
  387.  
  388.            case DPAGE:   menuid   = Menu[ MPAGESIZE ].menuid;
  389.                  curvalue = Menu[ MPAGESIZE ].curvalue;
  390.                  xobj     = MPAGESIZE;    
  391.                  offset   = 5;
  392.                  txtptr   = size_text;
  393.                  xtitle   = STITLE;
  394.                  break;
  395.  
  396.            case DCOLOR:  menuid   = Menu[ MCOLOR ].menuid;
  397.                  curvalue = Menu[ MCOLOR ].curvalue;
  398.                  xobj     = MCOLOR;
  399.                  offset   = 0;
  400.                  txtptr   = color_text;
  401.                  xtitle   = CTITLE;
  402.                  break;
  403.  
  404.            case DPORT:   menuid   = Menu[ MPORT ].menuid;
  405.                  curvalue = Menu[ MPORT ].curvalue;
  406.                  xobj     = MPORT;
  407.                  offset   = 2;
  408.                  txtptr   = port_text;
  409.                  xtitle   = PTITLE;
  410.                  break;
  411.  
  412.            case DTRAY:   menuid   = Menu[ MTRAY ].menuid;
  413.                  curvalue = Menu[ MTRAY ].curvalue;
  414.                  xobj     = MTRAY;
  415.                  offset   = 4;
  416.                  txtptr   = tray_text;
  417.                  xtitle   = TTITLE;
  418.                  break;
  419.         
  420.            default:
  421.                    break;
  422.                               
  423.             }
  424.             if( button != DPRINT )
  425.                 disable( tree, DPRINT );
  426.                 
  427.             if( button != DPAGE )
  428.                 disable( tree, DPAGE );
  429.                 
  430.             if( button != DCOLOR )
  431.                 disable( tree, DCOLOR );
  432.                 
  433.             if( button != DPORT )    
  434.                 disable( tree, DPORT );
  435.             
  436.             if( button != DTRAY )    
  437.                 disable( tree, DTRAY );
  438.  
  439.             select( tree, xtitle );
  440.             
  441.             value = PopUpMenuSelect( menuid, xrect.g_x, xrect.g_y, curvalue );        
  442.             if( value != -1L )
  443.             {
  444.                item  = (int)value;
  445.                id = (int)( value >> 16L );
  446.  
  447.            if( ( item != -1 ) && ( id != Menu[ MREZ ].menuid ))
  448.            {
  449.                   CheckItem( id, curvalue, FALSE );
  450.                   CheckItem( id, item, TRUE );
  451.                   Menu[ xobj ].curvalue = item;
  452.                   SetStartItem( id, item );
  453.  
  454.                   strcpy( Menu[ xobj ].text, txtptr[ Menu[ xobj ].curvalue + offset ] );
  455.                   ObString( button ) = Menu[ xobj ].text;
  456.                   Objc_draw( tree, button, MAX_DEPTH, NULL );
  457.                   
  458.                   if( menuid == Menu[ MCOLOR ].menuid )
  459.                   {
  460.               /* Calculate the new pixel xres and yres values
  461.                * ensuring that the inches or centimeters remain
  462.                * the same.
  463.                */
  464.                   hdr->nplanes = Menu[ MCOLOR ].curvalue + 1;
  465.                       xdpi = hdr->X_PIXEL[ hdr->nplanes - 1 ];
  466.                       ydpi = hdr->Y_PIXEL[ hdr->nplanes - 1 ];
  467.  
  468.               /* ZERO BASED - so, we subtract 1 pixel */  
  469.               xres_value = hdr->xres = ((int)( Xres * (float)xdpi )) - 1;
  470.               yres_value = hdr->yres = ((int)( Yres * (float)ydpi )) - 1;
  471.               
  472.  
  473.                       Menu[ MHSIZE ].curvalue = item;
  474.                       Menu[ MVSIZE ].curvalue = item;
  475.                       strcpy( Menu[ MVSIZE ].text, hsize_text[ Menu[ MVSIZE ].curvalue ] );
  476.                       strcpy( Menu[ MHSIZE ].text, vsize_text[ Menu[ MHSIZE ].curvalue ] );
  477.                       Objc_draw( tree, DHSIZE, MAX_DEPTH, NULL );
  478.                       Objc_draw( tree, DVSIZE, MAX_DEPTH, NULL );
  479.                   }
  480.                }
  481.                
  482.                if( ( item != -1 ) && ( id == Menu[ MREZ ].menuid ) )
  483.                {
  484.                   xdpi = hdr->X_PIXEL[ hdr->nplanes - 1 ];
  485.                   ydpi = hdr->Y_PIXEL[ hdr->nplanes - 1 ];
  486.  
  487.           /* ZERO BASED - so we add one pixel */
  488.                   Xres = hdr->xres + 1;
  489.                   Yres = hdr->yres + 1;
  490.             
  491.                   Xres /= xdpi;    /* gets us inches */
  492.                   Yres /= ydpi;
  493.                   
  494.                   ActiveTree( xytree );
  495.  
  496.  
  497. #if UK | FRENCH | GERMAN | SPAIN | ITALY | SWEDEN
  498.              sprintf( xtext, "%2.2f", Xres * 2.54 );
  499.             sprintf( ytext, "%2.2f", Yres * 2.54 ); 
  500.                     TedText( XYUNITS ) = xy2_unit;
  501. #endif
  502.  
  503. #if USA
  504.              sprintf( xtext, "%2.1f", Xres );
  505.             sprintf( ytext, "%2.1f", Yres );
  506.                     TedText( XYUNITS ) = xy1_unit;
  507. #endif
  508.  
  509.                   
  510.                   TedText( SETX ) = xtext;
  511.                   TedText( SETY ) = ytext;
  512.                   xstart = (( !item ) ? ( SETX ) : ( SETY ) );
  513.           output = execform( xytree, xstart );
  514.           ActiveTree( drivetree );
  515.           if( output == XYOK )
  516.           {
  517.                       CheckItem( menuid, curvalue, FALSE );
  518.                       CheckItem( menuid, 4, TRUE ); /* set to OTHER */
  519.                       Menu[ xobj ].curvalue = 4;
  520.                       SetStartItem( menuid, 4 );
  521.                       strcpy( Menu[ xobj ].text, txtptr[ Menu[ xobj ].curvalue + offset ] );
  522.                       ObString( button ) = Menu[ xobj ].text;
  523.  
  524.               tempx = atof( xtext );
  525.               tempy = atof( ytext );
  526.               
  527.               if( ( ( tempx > 0.0 ) && ( tempy > 0.0 ) ) &&
  528.                   ( ( tempx <= 99.9 ) && ( tempy <= 99.9 ) ))
  529.               {
  530.  
  531. #if UK | FRENCH | GERMAN | SPAIN | ITALY | SWEDEN
  532.                 tempx /= 2.54;
  533.                 tempy /= 2.54;
  534.                 
  535. #endif
  536.                 Xres = tempx;
  537.                 Yres = tempy;
  538.  
  539.                 /* ZERO BASED - so, we subtract 1 pixel */  
  540.                 xres_value = hdr->xres = ( tempx * xdpi ) - 1;
  541.                 yres_value = hdr->yres = ( tempy * ydpi ) - 1;
  542.  
  543.  
  544. #if USA
  545.                  /* If USA, use inches */
  546.                   sprintf( rez_text[0], rez_width, Xres );
  547.                   sprintf( rez_text[1], rez_height, Yres );
  548. #endif
  549.  
  550. #if UK | FRENCH | GERMAN | SPAIN | ITALY | SWEDEN
  551.                   /* Get us CM for other than USA */
  552.                   sprintf( rez_text[0], rez2_width, Xres * 2.54 );
  553.                   sprintf( rez_text[1], rez2_height, Yres * 2.54 );
  554. #endif
  555.  
  556.                 
  557.                         SetItem( Menu[ MREZ ].menuid, 0, rez_text[0] );
  558.                         SetItem( Menu[ MREZ ].menuid, 1, rez_text[1] );
  559.                       }  
  560.           }
  561.           Objc_draw( tree, ROOT, MAX_DEPTH, NULL );          
  562.                }
  563.                
  564.             }
  565.      
  566.        if( button != DPRINT )
  567.             enable( tree, DPRINT );
  568.             
  569.        if( button != DPAGE )
  570.             enable( tree, DPAGE );
  571.             
  572.        if( button != DCOLOR )
  573.             enable( tree, DCOLOR );
  574.             
  575.        if( button != DPORT )
  576.             enable( tree, DPORT );
  577.             
  578.        if( button != DTRAY )
  579.              enable( tree, DTRAY );
  580.  
  581.            deselect( tree, xtitle );
  582.      }
  583.      if( IsSelected( button ) )
  584.             deselect( tree, button );
  585.       }
  586.       else
  587.       {
  588.          if( button == DOK )
  589.                Save_Data();
  590.       }
  591.       
  592.    }while( ( button != DCANCEL ) && ( button != DOK ) );
  593.    
  594.    Form_dial( FMD_FINISH, &rect, &rect );
  595.    Deselect( button );
  596.  
  597.    /* Free up the buffer */
  598.    if( DataBuf )
  599.      free( DataBuf );
  600. }
  601.  
  602.  
  603. /* WaitUpButton()
  604.  * ======================================================================
  605.  */
  606. void
  607. WaitUpButton( void )
  608. {
  609.    MRETS mk;
  610.  
  611.    do
  612.    {
  613.       Graf_mkstate( &mk );
  614.    }while( mk.buttons );
  615. }
  616.  
  617.  
  618. /* ClearCheckMarks()
  619.  * ======================================================================
  620.  */
  621. void
  622. ClearCheckMarks( void )
  623. {
  624.      int    i,j;
  625.      long   length;
  626.      int    mask;
  627.      int    xdpi,ydpi;
  628.      float  Xres,Yres;
  629.      char   *ptr;
  630.           
  631.      xdpi = hdr->X_PIXEL[ hdr->nplanes - 1 ];
  632.      ydpi = hdr->Y_PIXEL[ hdr->nplanes - 1 ];
  633.  
  634.      /* ZERO BASED - so we add 1 pixel */
  635.      Xres = hdr->xres + 1;
  636.      Yres = hdr->yres + 1;
  637.             
  638.      Xres /= xdpi;    /* gets us inches */
  639.      Yres /= ydpi;
  640.  
  641.  
  642.  
  643. #if USA
  644.        sprintf( rez_text[0], rez_width, Xres );
  645.        sprintf( rez_text[1], rez_height, Yres );
  646. #endif
  647.  
  648.  
  649. #if UK | FRENCH | GERMAN | SPAIN | ITALY | SWEDEN
  650.        sprintf( rez_text[0], rez2_width, Xres * 2.54 );
  651.        sprintf( rez_text[1], rez2_height, Yres * 2.54 );
  652. #endif
  653.        
  654.      
  655. /* We must clear the array completely. Strings are terminated with '\0'
  656.  * and must be nulled out to the next string.
  657.  */
  658.      for( i = 0; i < 2; i++ )
  659.      {
  660.         length = strlen( rez_text[i] );
  661.         ptr    = rez_text[i];
  662.         ptr    += length;
  663.         for( j = (int)length; j < 19; j++ )
  664.            *ptr++ = '\0';
  665.      }
  666.  
  667.      for( i = 0; i < 2; i++ )
  668.      {
  669.        CheckItem( Menu[ MQUALITY ].menuid, i, FALSE );
  670.        CheckItem( Menu[ MPORT ].menuid, i, FALSE );
  671.        SetItem( Menu[ MREZ ].menuid, i, rez_text[i] );
  672.      }
  673.      mask = 0x0002;
  674.      Menu[ MPAGESIZE ].num_items = 0;
  675.      for( i = 0; i < 5; i++ )
  676.      {
  677.        CheckItem( Menu[ MPAGESIZE ].menuid, i, FALSE );
  678.        if( hdr->config_map & mask )
  679.        {
  680.           EnableItem( Menu[ MPAGESIZE ].menuid, i );
  681.           Menu[ MPAGESIZE ].num_items++;
  682.        }   
  683.        else
  684.       DisableItem( Menu[ MPAGESIZE ].menuid, i );
  685.        mask = mask << 1;
  686.      }  
  687.  
  688.  
  689.      for( i = 0; i < 3; i++ )
  690.      { 
  691.        CheckItem( Menu[ MCOLOR ].menuid, i, FALSE );
  692.        Menu[ MCOLOR ].num_items = hdr->total_planes - 1;
  693.      }
  694.  
  695.      mask = 0x0200;
  696.      Menu[ MTRAY ].num_items     = 0;
  697.      for( i = 0; i < 4; i++ )
  698.      {
  699.        CheckItem( Menu[ MTRAY ].menuid, i, FALSE );
  700.  
  701.        if( hdr->config_map & mask )
  702.        {
  703.           EnableItem( Menu[ MTRAY ].menuid, i );
  704.           Menu[ MTRAY ].num_items++;
  705.        }   
  706.        else   
  707.       DisableItem( Menu[ MTRAY ].menuid, i );
  708.        mask = mask << 1;
  709.            
  710.        CheckItem( Menu[ MHSIZE ].menuid, i, FALSE );
  711.        sprintf( vsize_text[i], "%d", hdr->Y_PIXEL[i] );
  712.        sprintf( hsize_text[i], "%d", hdr->X_PIXEL[i] );
  713.      }     
  714.  
  715.      /* check for wot's available */
  716.      
  717.      Menu[ MVSIZE ].num_items    = 0;
  718.      Menu[ MHSIZE ].num_items    = 0;
  719.      Menu[ MQUALITY ].num_items  = 2;
  720.      Menu[ MPORT ].num_items     = 2;
  721.      Menu[ MHSIZE ].curvalue     = Menu[ MVSIZE ].curvalue = 0;
  722. }
  723.  
  724.  
  725. /* execform()
  726.  * ================================================================
  727.  * Custom routine to put up a standard dialog box and wait for a key.
  728.  */
  729. int
  730. execform( OBJECT *xtree, int start_obj )
  731. {
  732.    GRECT rect;
  733.    GRECT xrect;
  734.    int button;
  735.    
  736.    xrect.g_x = xrect.g_y = 10;
  737.    xrect.g_w = xrect.g_h = 36;
  738.    
  739.    Form_center( xtree, &rect );
  740.    Form_dial( FMD_START, &xrect, &rect );
  741.    Objc_draw( xtree, ROOT, MAX_DEPTH, &rect );
  742.    button = form_do( xtree, start_obj );
  743.    Form_dial( FMD_FINISH, &xrect, &rect );
  744.    Deselect( button );
  745.    return( button );
  746. }
  747.  
  748.  
  749.  
  750.  
  751. /* DoDrivers()
  752.  * =======================================================================
  753.  * Handles the FPrinter Popup menu.
  754.  */
  755. void
  756. DoDrivers( int num )
  757. {
  758.    sprintf( FPath, "%s\\%s", bitmap_path, &drivers[ cdriver_array[ num ] ] );
  759.       
  760.    MF_Save();
  761.    if( AES_Version >= 0x0320 )
  762.       graf_mouse( BUSYBEE, 0L );
  763.  
  764.    if( Read_Data() )
  765.    {
  766.         OptionInit();
  767.         MF_Restore();
  768.         do_modify();
  769.         OptionEnd();
  770.    }
  771.    
  772.    ActiveTree( ad_front );
  773.    MF_Restore();
  774. }
  775.  
  776.  
  777.